import { createApp } from 'vue'
//引入cookies
import VueCookies from 'vue-cookies'
//引入element plus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import '@/assets/styles/base.scss'
import '@/assets/icon/iconfont.css'
import "@kangc/v-md-editor/lib/theme/style/vuepress.css";
import "@kangc/v-md-editor/lib/style/base-editor.css";
import '@kangc/v-md-editor/lib/style/preview.css'
import App from '@/App.vue'
import router from '@/router/index'
import store from '@/store/index'
import Confirm from '@/utils/Confirm'
//全局组件
import Dialog from '@/components/Dialog.vue'
import Avatar from '@/components/Avatar.vue'
import Cover from '@/components/Cover.vue'
import DataList from '@/components/DataList.vue'
import Nodata from '@/components/Nodata.vue'
import ImageViewer from '@/components/ImageViewer.vue'
import EditHtml from '@/components/EditHtml.vue'
import EditorMarkdown from '@/components/EditorMarkdown.vue'
import CoverUpload from '@/components/CoverupLoad.vue'
import AttachmentSelector from '@/components/AttachmentSelector.vue'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
//全局方法
import Verify from '@/utils/Verify'
import Message from '@/utils/Message'
import Request from '@/utils/Request'
import Utils from '@/utils/Utils'
const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
app.use(router)
app.use(store)
app.use(ElementPlus);

//全局变量
app.config.globalProperties.VueCookies = VueCookies;
app.config.globalProperties.Verify = Verify;
app.config.globalProperties.Message = Message;
app.config.globalProperties.Utils = Utils;
app.config.globalProperties.Request = Request;
app.config.globalProperties.Confirm = Confirm;
app.config.globalProperties.globalInfo = {
    bodyWidth: 1300,
    avatarUrl: "/api/file/getAvatar/",
    imageUrl: "/api/file/getImage/"
}
app.component('Dialog', Dialog)
app.component('Avatar', Avatar)
app.component('Cover', Cover)
app.component('DataList', DataList)
app.component('Nodata', Nodata)
app.component('ImageViewer', ImageViewer)
app.component('EditHtml', EditHtml)
app.component('EditorMarkdown', EditorMarkdown)
app.component('CoverUpload', CoverUpload)
app.component('AttachmentSelector', AttachmentSelector)
app.mount('#app')
